from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node

def generate_launch_description():
    # Define arguments that can be passed when launching the node
    target_frame_arg = DeclareLaunchArgument(
        'target_frame',
        default_value='odom',
        description='Target frame for the TF broadcast'
    )

    # odom_topic_arg = DeclareLaunchArgument(
    #     'odom_topic',
    #     default_value='/odom/unfiltered',
    #     description='Input odometry topic'
    # )

    robot_ns_arg = DeclareLaunchArgument(
        'robot_ns',
        default_value='robot_0',
        description='Robot namespace'
    )

    # Define the node action with remapping capabilities
    tf_publisher_node = Node(
        package='odom_tf_publisher',  # Replace with your actual package name
        executable='tf_publisher_node',  # Replace with your actual node executable name
        output='screen',
        parameters=[{'target_frame': LaunchConfiguration('target_frame'),
                     'robot_ns': LaunchConfiguration('robot_ns')}]
    )

    return LaunchDescription([
        target_frame_arg,
        # odom_topic_arg,
        tf_publisher_node
    ])



